import initial


def get_person(name):
    family = initial.get_family()
    for i in family:
        if i.name == name:
            return i


def get_count(person):
    count = 1
    while person.father:
        person = person.father
        count += 1
    return count


def judge():
    name = input('请输入两个人的姓名(通过空格格开)\n>>>').split(' ')
    name1 = name[0]
    name2 = name[1]
    person1 = get_person(name1)
    person2 = get_person(name2)
    count1 = get_count(person1)
    count2 = get_count(person2)
    if count1 == count2:
        print('%s和%s是兄弟' % (name1, name2))
    if count1 == count2 - 1:
        if person2.father.name == person1.name:
            print('%s是%s的父亲' % (name1, name2))
        else:
            print('%s是%s的叔叔' % (name1, name2))
    if count1 == count2 + 1:
        if person1.father.name == person2.name:
            print('%s是%s的儿子' % (name1, name2))
        else:
            print('%s是%s的侄子' % (name1, name2))
    if count1 == count2 - 2:
        print('%s是%s的祖父' % (name1, name2))
    if count1 == count2 + 2:
        print('%s是%s的孙子' % (name1, name2))
    if count1 == count2 - 3:
        print('%s是%s的曾祖父' % (name1, name2))
    if count1 == count2 + 3:
        print('%s是%s的曾孙子' % (name1, name2))
